package com.studentmanager.servlet;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.studentmanager.dao.TeacherDAOImpl;
import com.studentmanager.vo.Teacher;

public class SearchTeacherByIdServlet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doPost(request, response);
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
         String teNo=request.getParameter("searchteacherId");
         TeacherDAOImpl teacherdao=new TeacherDAOImpl();
         Teacher teacher=teacherdao.findTeacherById(teNo);
         request.setAttribute("teacher", teacher);
         String mainPage = "ShowTeacher.jsp";
 		 request.setAttribute("mainPage", mainPage);
 		 RequestDispatcher dispatcher = request.getRequestDispatcher("Admin.jsp");
 		 dispatcher.forward(request, response);
	}

}
